#ifndef MPHTTPRESPONSEMESSAGEIMPL_H
#define MPHTTPRESPONSEMESSAGEIMPL_H

/*****************************************
 * HttpResponseMessageImpl 继承于 HttpResponseMessage
 *****************************************/

#include "mpHttpResponseMessage.h"

namespace MP{
namespace HTTP{
namespace INTERNAL{


class HttpResponseMessageImpl : public HttpResponseMessage
{
public:
    HttpResponseMessageImpl();
    HttpResponseMessageImpl(std::stringstream& sstream);
    HttpResponseMessageImpl(const std::string& filePath,
                            std::size_t fileOffset);
    ~HttpResponseMessageImpl() override = default;

public:
    //设置HTTP连接的唯一ID
    virtual void setConnectionId(const std::string & connectionId) override;
    //获取HTTP连接的唯一ID
    virtual const std::string& getConnectionId() const override;
    //获取HTTP协议版本
    virtual const std::string& getHttpVersion() const override;
    //获取收到的HTTP响应代码
    virtual int getResponseCode() const override;
    //检查收到的HTTP响应代码是否代表请求成功
    virtual bool checkResponseCodeIsSuccess() override;

    //获取服务器与状态代码一起发送的原因短语
    virtual  const std::string& getReasonPhrase() const override;
    //指示HTTP响应是否成功
    virtual bool isSuccess() const override;
    //是否使用的HTTP1.0协议
    virtual bool isHttpVersion_1_0() const override;
    virtual HTTP_SEND_STATU_CODE getSendStatuCode() const override;
    virtual void setSendStatuCode(HTTP_SEND_STATU_CODE sendStatuCode) override;
    virtual void setReadStatus(const std::string & http_version,
                               unsigned int responseCode,
                               const std::string & reasonPhrase) override;

    //关于 HttpRequestHeaders
    HttpResponseHeaders& getHttpResponseHeaders() override;
    //关于 HttpResponseContent
    HttpResponseContent::ptr_s getHttpResponseContent() const override;

private:
    std::string _connectionId;
    HttpResponseHeaders _httpHeaders;                       //请求Headers
    HttpResponseContent::ptr_s _responseContent;          //请求数据包

    std::string _http_version;                                              //HTTP协议版本
    bool _is_http_version_1_0 = false;                                      //HTTP协议版本是否为1.0
    unsigned int _responseCode = 0;                                         //HTTP状态码
    std::string _reasonPhrase;                                              //HTTP原因短语（状态代码一起发送的）
    HTTP_SEND_STATU_CODE _send_statu_code = HTTP_SEND_STATU_CODE::Unkown;   //SEND状态码

};


}   //INTERNAL
}   //HTTP
}   //MP

#endif // MPHTTPRESPONSEMESSAGEIMPL_H
